# class CacheBase:
#     def get(self, key):
#         raise NotImplementedError
#
#
# class RedisCache(CacheBase):
#     # 如果用户没有重写 get方法，抛出异常
#     pass
#
#
# cache = RedisCache()
# cache.get("aa")  # 抛出异常NotImplementedError


# 导入python 全局抽象基类,装饰器abc 做规范限制
import abc


class CacheBase(metaclass=abc.ABCMeta):  # 规定为抽象类
    @abc.abstractmethod  # 规定为抽象方法
    def get(self, key):
        pass


class RedisCache(CacheBase):
    def get(self, key):
        pass


cache = RedisCache()
cache.get("a")

"""
进来不去使用抽象基类，多去利用多继承mixin
"""